<template>
    <div class="play_list">
      <Header title="用户歌单" go-back="true"></Header>
      <div class="play_box">
        <ul>
          <li v-for="(img, index) in playList" :key="index" @click="clickMusic(img.coverImgId)">
            <div class="music_img">
              <img :src="img.coverImgUrl" alt="">
            </div>
            <div class="music_content">
              <p>{{img.name}}</p>
              <p>{{img.trackCount}}首</p>
            </div>
          </li>
        </ul>
      </div>
    </div>
</template>

<script>
import Header from '../../Header/Header'
import {getPlayList} from '../../../api/node'

export default {
  name: 'child4Page2',
  data () {
    return {
      playList: []
    }
  },
  mounted () {
    getPlayList().then(res => {
      // console.log(res)
      if (res.code === 200) {
        this.playList = res.playlist
      }
    })
  },
  methods: {
    clickMusic (id) {
      console.log(id)
    }
  },
  components: {Header}
}
</script>

<style lang="scss" scoped>
.play_list{
  width: 100%;
  padding-top: 50px;
  .play_box{
    ul{
      width: 100%;
      li{
        width: 100%;
        padding: 10px;
        display: inline-flex;
        align-items: center;
        border-bottom: 1px solid #f2f2f2;
        .music_img{
          width: 70px;
          height: 70px;
          border-radius: 5px;
          img{
            width: 100%;
            height: 100%;
          }
        }
        .music_content{
          padding-left: 10px;
          p:first-child{
            font-size: 15px;
            line-height: 30px;
          }
        }
      }
    }
  }
}
</style>
